import QtQuick 1.0
import "../../../common/lib/kdeadmouseutils-build-desktop"

Item {
	function killAll(){
		dwnldInvoke.kill();
		smplayer.kill();
	}
	function startThis(url){
		console.log('startThis:' + url);
		dwnldInvoke.shellAction ('/socMDC/KdeadMouse/apps/pluzz/bin/pluzzdl/main.py',[url]);
	}
	
	ShellInvoker {
		id:dwnldInvoke
		onFinished : {
		  console.log('finish dwnldInvoke');
		}
		onOutputLineChanged : {
		  console.log('dwnldInvoke:' + outputLine);
// 		  downloadStart/endDownload
		  if(outputLine.indexOf('directLink')==0){
			  var loc = outputLine.replace('directLink:','');
			  console.log('directLink...:' + loc);
			  smplayer.shellAction ('vlc',['--fullscreen',loc]) ;
			  return;
		  }else if(outputLine.indexOf('downloadStart')==0){
			  var loc = outputLine.replace('downloadStart:','');
			  console.log('downloading...:' + loc);
			  smplayer.shellAction ('vlc',['--fullscreen',loc]) ;
			  return;
		  }
		}
	}
	
	ShellInvoker {
		id:smplayer
		onFinished : {
		  console.log('finish smplayer');
		}
		onOutputLineChanged : {
		  console.log('smplayer/vlc:' + outputLine);
		}
	}
}